    <!-- form start -->
    <form role="form">
        <div class="card">

            <!--<div class="card-header">
                <h3 class="card-title">
                    <i class="fas fa-tag"></i>
                    新增角色
                </h3>
            </div>-->
            <!-- /.card-header -->
            <div class="card-body">
                <div class="form-group">
                    <label for="name">用户名称</label>
                    <input type="text" class="form-control" id="name" name="admin_name" placeholder="">
                </div>
                <div class="form-group">
                    <label for="name">密码</label>
                    <input type="password" class="form-control" id="password" name="password" placeholder="">
                </div>
                <div class="form-group">
                    <label>角色</label>
                    <select name="role_id" class="form-control">
                        <option>请选择</option>
                        {volist name="list" id="vo" key="k"}
                        <option value="{$vo.role_id}">{$vo.role_name}</option>
                        {/volist}
                    </select>
                </div>
                <div class="form-group">
                    <label for="name">邮箱</label>
                    <input type="text" class="form-control" id="email" name="email" placeholder="">
                </div>
                <div class="form-group">
                    <label for="">状态</label>
                    <div style="display: flex">
                        <div class="custom-control custom-radio col-3">
                            <input class="custom-control-input" type="radio" id="customRadio1" value="1" name="status" checked>
                            <label for="customRadio1" class="custom-control-label">开启</label>
                        </div>
                        <div class="custom-control custom-radio col-3">
                            <input class="custom-control-input" type="radio" id="customRadio2" value="0" name="status">
                            <label for="customRadio2" class="custom-control-label">禁用</label>
                        </div>
                    </div>
                </div>

            </div>
            <!-- /.card-body -->

            <div class="card-footer">
                <button type="button" id="submit" class="btn btn-primary">添加</button>
            </div>
        </div>
    </form>
<script>
    function pageJs( layero, index ) {
        $(layero).find("#submit").on('click', function () {
            var formData = new FormData($(layero).find('form')[0]);
            $.ajax({
                cache: true,
                type: "POST",
                url:"{:url('admin/user/doAdd')}",
                data:formData,
                dataType:'json',
                processData : false,
                async: true,
                contentType: false,
                error:function(XMLHttpRequest, textStatus, errorThrown){
                    // alert(textStatus);
                },
                success: function( response ) {
                    var code = parseInt( response.error_code );
                    switch (code) {
                        case 1:
                            popupBox( getMsgBox( {'success': response.msg}, 'success' ), function (alert_layero, alert_index) {
                                setTimeout(function () {
                                    layer.close( alert_index )
                                }, 600);
                            } );

                            setTimeout(function () {
                                layer.close( index );
                                location.reload();
                            }, 800);
                            break;
                        case 10000:
                            popupBox( getMsgBox( response.msg, 'danger' ) );
                            break;
                        default:
                            popupBox( getMsgBox( '操作出现问题了', 'danger' ) );
                    }
                }
            });
        });
    }
</script>
